Thread statuses improvements#398
Conversation
📝 WalkthroughWalkthroughTightened timestamp filtering in KernelThreadInformationProvider, refactored FlameChartDataProvider to group multiple linked kernel entry IDs per thread and build kernel states per linked entry, updated tests to expect syscall labeling and adjusted a stub's event handling; minor annotation formatting edits. ChangesThread Status Interval Filtering
Flame Chart Data Handling
Tests & Stub
Sequence Diagram(s)sequenceDiagram
participant Client
participant FlameChart as FlameChartDataProvider
participant SS as StateSystem
participant Tests
Client->>FlameChart: request kernel states for tid-list
FlameChart->>FlameChart: group TidInformation by TID -> linkedEntryIds set
FlameChart->>SS: query statuses for each TID once
SS->>FlameChart: return intervals
FlameChart->>FlameChart: iterate linkedEntryIds -> resolve entryId, build TimeGraphState per linked entry
FlameChart->>Tests: provide states (with syscall labels/styles)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/kernel/KernelThreadInformationProvider.java`:
- Line 551: The filter predicate for currentTimes is incorrect: change the
boolean operator so it keeps times within the session window instead of almost
always allowing them; in the times.stream() filter that references
ss.getCurrentEndTime() and ss.getStartTime(), replace the OR condition with an
AND (so times satisfy time < ss.getCurrentEndTime() && time > ss.getStartTime(),
adjust inclusivity if needed) to ensure only timestamps inside the current time
window are collected before sorting and collecting into currentTimes.
In
`@analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/instrumented/FlameChartDataProvider.java`:
- Around line 583-585: The threadIdsToEntryIds collection currently uses
Collectors.toList(), which allows duplicate tid.fLinked values per thread and
leads to duplicate kernel states during the status-expansion that follows;
change the collector on the tids stream (the code that builds
threadIdsToEntryIds in FlameChartDataProvider) to collect unique linked IDs
instead (e.g., use Collectors.toCollection(LinkedHashSet::new) or
Collectors.toSet() so each tid.fLinked appears only once per thread) and update
any downstream code that expects a List (the expansion loop that iterates over
threadIdsToEntryIds entries) to iterate the resulting Set or convert it to a
List if ordering is required.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e64aa7c9-86b3-4b37-be29-a807f56940e3
📒 Files selected for processing (2)
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/kernel/KernelThreadInformationProvider.javaanalysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/instrumented/FlameChartDataProvider.java
bdd20cc to
84539f9
Compare
…he same tid Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
84539f9 to
9a9e5c5
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
analysis/org.eclipse.tracecompass.analysis.profiling.core.tests/src/org/eclipse/tracecompass/analysis/profiling/core/tests/FlameChartDataProviderTest.java (2)
29-30: 💤 Low valueRemove commented-out duplicate imports.
Lines 29 and 59 are commented-out versions of their immediately adjacent active imports — debug artifacts that add noise.
🧹 Proposed cleanup
-//import java.util.stream.Collectors; import java.util.stream.Collectors;import org.eclipse.tracecompass.tmf.core.model.annotations.Annotation; -//import org.eclipse.tracecompass.tmf.core.model.annotations.Annotation;Also applies to: 58-59
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@analysis/org.eclipse.tracecompass.analysis.profiling.core.tests/src/org/eclipse/tracecompass/analysis/profiling/core/tests/FlameChartDataProviderTest.java` around lines 29 - 30, In FlameChartDataProviderTest remove the commented-out duplicate import statements for java.util.stream.Collectors (the commented line above the active import and the duplicate at the later import block) so only the single active import remains; locate the commented "//import java.util.stream.Collectors;" entries near the top of the class and delete them to clean up noise introduced during editing.
439-444: 💤 Low valueDead-code branch in
verifyStatesafter the newassertEquals.Adding
assertEquals(expectedStates.size(), states.size())at line 439 is the right fix — it catches both under- and over-delivery of states. However, it makes lines 442–444 unreachable: the loop variableiis bounded bystates.size(), which is now asserted equal toexpectedStates.size(), soi > expectedStates.size() - 1is alwaysfalse. Thefail(...)can never execute.🧹 Proposed cleanup
assertEquals(expectedStates.size(), states.size()); for (int i = 0; i < states.size(); i++) { String entryName = entry.getName(); - if (i > expectedStates.size() - 1) { - fail("Unexpected state at position " + i + FOR_ENTRY + entryName + ": " + states.get(i)); - } ITimeGraphState actual = states.get(i); ITimeGraphState expected = expectedStates.get(i);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@analysis/org.eclipse.tracecompass.analysis.profiling.core.tests/src/org/eclipse/tracecompass/analysis/profiling/core/tests/FlameChartDataProviderTest.java` around lines 439 - 444, The new assertEquals(expectedStates.size(), states.size()) makes the conditional inside verifyStates' loop unreachable; remove the dead branch that checks "if (i > expectedStates.size() - 1) { fail(... entry.getName() ... states.get(i)) }" or replace the loop to iterate over expectedStates.size() and directly compare elements, so the fail(...) call and the unreachable i check are deleted; update verifyStates to perform direct comparisons between expectedStates.get(i) and states.get(i) (using entry.getName() only in failure messages).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@analysis/org.eclipse.tracecompass.analysis.profiling.core.tests/src/org/eclipse/tracecompass/analysis/profiling/core/tests/FlameChartDataProviderTest.java`:
- Around line 29-30: In FlameChartDataProviderTest remove the commented-out
duplicate import statements for java.util.stream.Collectors (the commented line
above the active import and the duplicate at the later import block) so only the
single active import remains; locate the commented "//import
java.util.stream.Collectors;" entries near the top of the class and delete them
to clean up noise introduced during editing.
- Around line 439-444: The new assertEquals(expectedStates.size(),
states.size()) makes the conditional inside verifyStates' loop unreachable;
remove the dead branch that checks "if (i > expectedStates.size() - 1) {
fail(... entry.getName() ... states.get(i)) }" or replace the loop to iterate
over expectedStates.size() and directly compare elements, so the fail(...) call
and the unreachable i check are deleted; update verifyStates to perform direct
comparisons between expectedStates.get(i) and states.get(i) (using
entry.getName() only in failure messages).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7a65ed87-2044-4802-bcab-72b639b00a43
📒 Files selected for processing (4)
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/kernel/KernelThreadInformationProvider.javaanalysis/org.eclipse.tracecompass.analysis.profiling.core.tests/src/org/eclipse/tracecompass/analysis/profiling/core/tests/FlameChartDataProviderTest.javaanalysis/org.eclipse.tracecompass.analysis.profiling.core.tests/stubs/org/eclipse/tracecompass/analysis/profiling/core/tests/stubs2/KernelStateProviderStub.javaanalysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/instrumented/FlameChartDataProvider.java
🚧 Files skipped from review as they are similar to previous changes (2)
- analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/kernel/KernelThreadInformationProvider.java
- analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/instrumented/FlameChartDataProvider.java
What it does
How to test
Open a callstack analysis that have threads callstacks with a kernel trace alongside it. For example using eclipse-tracecompass-incubator/org.eclipse.tracecompass.incubator#265
Follow-ups
N/A
Review checklist
Summary by CodeRabbit